package chain_of_responsibility_pattern.v2;

/**
 * 总监类
 * @author ricejson
 */
public class MajorDomo extends Manager {
    public MajorDomo(String name) {
        super(name);
    }

    @Override
    public void handleRequest(Request request) {
        // 处理总监相关的请求
        if (request.getRequestType().equals("请假") && request.getRequestNum() <= 5) {
            // 请假并且天数<=2
            System.out.println(name + ":" + request.getRequestContent() + " 数量" + request.getRequestNum() + "被批准");
        } else {
            // 其他事情无权处理
            System.out.println(name + ":" + request.getRequestContent() + " 数量" + request.getRequestNum() + "我无权处理");
            // 职责转交
            if (this.superior != null) {
                this.superior.handleRequest(request);
            }
        }
    }
}
